Introduction
The X-Edge platform loads custom vision algorithms of third-party developers through internal function calls. The platform has functions such as
- Timing map collection
- Task scheduling
- Task management
- Data interaction.
Calling Method
The X-Edge platform executes vision algorithms defined by third-party developers by calling standard functions. You need to override the algorithm function templates provided by the platform to implement your own algorithm.
- Provide the standard algorithm initialization function algorithmInitialization and the algorithm execution main function algorithmDetect.
- X-Edge platform uses python scripts to call these two functions.
The provided standard functions must be written in python, and the internal execution code can be written in other languages and compiled for python calling.
Vision Algorithm Execution Structure
Module Instruction
Algorithm Initialization (arguments, configs)
This function initializes your algorithms. It will only be executed once when the program starts running to load the algorithm model and auxiliary classes, and register basic parameters.
This function has no return parameters, and you are free to define the initialization content.
Input Parameter | Description |
---|---|
arguments |
|
configs | A JSON file contains preset input parameters when configuring the algorithm task, converted into a python dict dictionary object in the program. It is a list of dictionaries, and each element in the list is a configuration dictionary for a task.
|
Send, data_map= algorithmDetect(image, timestamp, config, argument)
The algorithmDetect function will be executed when the current task is being called, and the calling process will automatically read the picture, timestamp, configuration, and parameters of the current task and pass them to the function.
- Input parameters:
Parameter | Description |
---|---|
image | RGB image for identification. |
timestamp | The host timestamp when the image was acquired. |
config | The configuration related to the current task.
|
argument | Parameters related to the current task, including standard parameters, such as the detection area detectArea, and the parameters actively registered during initialization.
|
- Return value:
Parameter | Description |
---|---|
send | Boolean, indicating whether to send data currently. If send=True, the communication component will organize the result data and send it to the platform. |
data_map | Data dictionary, the structure requirements are:
|
Algorithm Installation Instructions
After the algorithm is developed, you need to compress and upload it to the platform.
- For python developers, a requirements.txt file is necessary in the algorithm package, which is convenient for the platform to build an operating environment.
- For developers of other compilable languages, put the required link libraries and algorithm packages together to prevent problems such as missing libraries. Attach a runtime.json file to the package to describe the running environment. For example:
{
'algorithmName': helmet,
'algorithmShowName': helmet algorithm,
'algorithmCode': 3fxda44gf5a3m,
'algorithmDescription': helmet detection algorithm,
'algorithmVersion': 1.0.0,
'algorithmTarget': 2,
'device': 'gpu',
'CUDA_version': '10.2'
}
Parameter | Description |
---|---|
algorithmName | Algorithm name. required. English lowercase name. Length limit 1~50. |
algorithmShowName | Algorithm display name. |
algorithmCode | Algorithm code, unique identification code. required. Combination of English letters and numbers. Length limit 8~32. |
algorithmDescription | Algorithm short description. |
algorithmVersion | Custom algorithm version. |
algorithmTarget | Detection targets of the algorithm. 0-person, 1-car, 2-other. |
device | Select form gpu and cpu. |
CUDA_version | If the device is gpu, CUDA version needs to be specified. |